package yunwo.cn.yzstation.view.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.zhy.http.okhttp.callback.StringCallback;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.Call;
import yunwo.cn.yzstation.R;
import yunwo.cn.yzstation.adapter.CarsAdapter;
import yunwo.cn.yzstation.api.HttpManager;
import yunwo.cn.yzstation.base.MyBaseActivity;
import yunwo.cn.yzstation.bean.CarListBean;
import yunwo.cn.yzstation.config.MyConstants;
import yunwo.cn.yzstation.view.fregment.carsdetail.CarInfoFregment;
import yunwo.cn.yzstation.view.fregment.carsdetail.GoodsInfoFregment;

/**
 * Created by lao on 2017/10/13.
 */
public class CarsDetailsActivity extends MyBaseActivity{

    private TabLayout mCars_tab;
    private ViewPager mCars_vp;
    private CarInfoFregment mCarInfoFregment;
    private GoodsInfoFregment mGoodsInfoFregment;
    private CarListBean.DataBean.ListBean mDepart;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDepart = (CarListBean.DataBean.ListBean) getIntent().getSerializableExtra("depart");

        initView();

    }

    public CarListBean.DataBean.ListBean getData() {
        return mDepart;
    }

    private void initView() {
        mCars_tab = (TabLayout) findViewById(R.id.cars_tab);
        mCars_vp = (ViewPager) findViewById(R.id.cars_vp);
        List<Fragment> list = new ArrayList<>();
        mCarInfoFregment = new CarInfoFregment();
        mGoodsInfoFregment = new GoodsInfoFregment();
        list.add(mCarInfoFregment);
        list.add(mGoodsInfoFregment);
        CarsAdapter carsAdapter = new CarsAdapter(getSupportFragmentManager(), list);
        mCars_vp.setAdapter(carsAdapter);
        mCars_tab.setupWithViewPager(mCars_vp);

    }

    @Override
    protected String settiltile() {
        return "车次详情";
    }

    @Override
    protected int getLayoutRsid() {
        return R.layout.activity_carsdetails;
    }
}
